package com.sc.test.windowSoftInputMode;

import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import android.view.View;
import android.view.WindowManager;
import android.widget.EditText;
import android.widget.TextView;

import com.sc.test.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Shen Chao.
 * Created on 2018-10-25.
 */
public class WindowSoftInputModeActivity extends AppCompatActivity {
    @BindView(R.id.tv_description)
    TextView tvDescription;
    private Intent intent;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_windowsoftinputmode);
        ButterKnife.bind(this);
        tvDescription.setText(getString(R.string.window_input_type_decription));
        intent = new Intent(this, WindowInputResultActivity.class);
    }

    @OnClick({R.id.bt_stateUnspecified, R.id.bt_stateUnchanged, R.id.bt_stateHidden,
            R.id.bt_stateAlwaysHidden, R.id.bt_stateVisible, R.id.bt_stateAlwaysVisible,
            R.id.bt_adjustUnspecified, R.id.bt_adjustResize, R.id.bt_adjustPan})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.bt_stateUnspecified:
                intent.putExtra("inputMode", WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED);
                startActivity(intent);
                break;
            case R.id.bt_stateUnchanged:
                intent.putExtra("inputMode", WindowManager.LayoutParams.SOFT_INPUT_STATE_UNCHANGED);
                startActivity(intent);
                break;
            case R.id.bt_stateHidden:
                intent.putExtra("inputMode", WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
                startActivity(intent);
                break;
            case R.id.bt_stateAlwaysHidden:
                intent.putExtra("inputMode", WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
                startActivity(intent);
                break;
            case R.id.bt_stateVisible:
                intent.putExtra("inputMode", WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
                startActivity(intent);
                break;
            case R.id.bt_stateAlwaysVisible:
                intent.putExtra("inputMode", WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
                startActivity(intent);
                break;
            case R.id.bt_adjustUnspecified:
                intent.putExtra("inputMode", WindowManager.LayoutParams.SOFT_INPUT_ADJUST_UNSPECIFIED);
                startActivity(intent);
                break;
            case R.id.bt_adjustResize:
                intent.putExtra("inputMode", WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
                startActivity(intent);
                break;
            case R.id.bt_adjustPan:
                intent.putExtra("inputMode", WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN);
                startActivity(intent);
                break;
        }
    }
}
